package com.example.conp;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;


public class Untils
{
    private static Object ut;
    private static final String DATABASE_NAME = "stu";  //数据库名
    private static final int DATABASE_VERSION = 1;
    MySqlit op;
    SQLiteDatabase os;
    Context context;

    public Untils(Context content)
    {
       //op=new MySqlit(DATABASE_NAME ,null,DATABASE_VERSION );
       os = op.getWritableDatabase();

    }

    public Untils()
    {

    }

    public static synchronized Untils getInstance(){
        if(ut==null)
        ut= new Untils();
        return (Untils) ut;
    
    }  

    public void add()
    {
        os.beginTransaction();
        os.execSQL("insert into stu values(?,?,?)",new Object[]{"刘宇","Henry","23"});
        os.endTransaction();
        
    }
    public void quer()
    {

        os.beginTransaction();
        Cursor cs;
        cs=  os.query("stu",null,null,null,null,null,null);

        boolean cp;
        while (cp=cs.moveToNext())
           {

               String name=cs.getColumnName(1);
           }

        os.endTransaction();


    }
    
}
